from heapq import *
from random import *

'''
打印乘法表
1： 1~9
2： 1~9
'''
print("xxxx")
for i in range(1, 10):
    row = "";
    for j in range(1, 10):
        if j <= i:
            row += "{}*{}={} ".format(i, j, (i)*(j))
    print(row)


'''

马老师最优解：
'''
print('''

''')
for i in range(1, 10):
    for j in range(1, i+1):
        print("%s*%s=%s"%(i, j, i*j), end=' ')
    print("")

'''

第二解
'''
print('''

''')
for i in range(1, 10):
    out = []
    for j in range(1, i+1):
        out.append("%s*%s=%s"%(i, j, i*j))
    print(' '.join(out))

print('''

排序：

''')
a = [12, 15, 9, 25, 8, 4, 37]
b = [1, 8, 10, 100, 91, 33, 69]
print("a:")
print(a)
print("b:")
print(b)
c = (a + b)
print("c:")
print(c)


k = 10
# print(k)
l = (random() for x in range(1000))
#help(heapq.heap)
h = [-2] * k
# heapify(c)
for v in l:
    w = v * -1
    if w > h[0]:
        heapreplace(h, w)

for i in h:
    print (-1 * i)

# print(nsmallest(3, l))